﻿<%@ Page Language="C#" AutoEventWireup="true" Title="Rentals | QuickWheelz" MasterPageFile="~/quickwheels.master"CodeFile="Rentals.aspx.cs" Inherits="Rentals" %>


<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="headerPlaceHolder">
</asp:Content>

<asp:Content ID="Content4" runat="server" ContentPlaceHolderID="menubarPlaceHolder">
</asp:Content>

<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="bodyPlaceHolder">
    <div class="form_view_div">

        <asp:ObjectDataSource ID="quickwheelzODS" runat="server" TypeName="quickwheelz" SelectMethod="getRentals" UpdateMethod="updateRental" InsertMethod="insertRental">

            <UpdateParameters>
                <asp:Parameter Name="invoiceNumber" Type="Int32" />
                <asp:Parameter Name="customerId" Type="Int32" />
                <asp:Parameter Name="vinId" Type="String" />
                <asp:Parameter Name="returnDate" Type="DateTime"/>
                <asp:Parameter Name="issueDate" Type="DateTime"/>
                <asp:Parameter Name="rentalFee" DbType="Decimal"/>
            </UpdateParameters>

            <InsertParameters>
                <asp:Parameter Name="invoiceNumber" Type="Int32" />
                <asp:Parameter Name="customerId" Type="Int32" />
                <asp:Parameter Name="vinId" Type="String" />
                <asp:Parameter Name="returnDate" DbType="Date"/>
                <asp:Parameter Name="issueDate" DbType="Date"/>
                <asp:Parameter Name="rentalFee" DbType="Decimal" />
            </InsertParameters>

        </asp:ObjectDataSource>

        <asp:FormView ID="FormView1"  runat="server" DataSourceID="quickwheelzODS"
            EnableModelValidation="True" BackColor="White" BorderColor="#999999" 
            BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical" 
            AllowPaging="True" DataKeyNames="invoiceNumber" DataMember="DefaultView" 
            onpageindexchanging="FormView1_PageIndexChanging">

            <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
            <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#999999" ForeColor="Black" Font-Bold="true" Font-Underline="true"  HorizontalAlign="Left" />
            <RowStyle BackColor="#EEEEEE" ForeColor="Black" />

            <HeaderTemplate>
                <asp:Label ID="lblFormHEader" runat="server" Text="CUSTOMER RENTAL"></asp:Label>
            </HeaderTemplate>
            <FooterTemplate>
                <asp:Button ID="btnUpdateMode" runat="server" Text="Edit" OnClick="btnUpdateMode_click"/>&nbsp;&nbsp;
                <asp:Button ID="btnInsertMode" runat="server" Text="Create Rental" OnClick="btnInsertMode_click"/>
            </FooterTemplate>

            <ItemTemplate>
                <tr>
                    <td>Invoice Number: </td> <td><asp:Label ID="Label1" runat="server" Text='<%# Eval("invoiceNumber")%>'></asp:Label></td>
                </tr>
                <tr>
                    <td>VIN Id: </td> <td><asp:Label ID="Label2" runat="server" Text='<%# Eval("vinId")%>'></asp:Label></td>
                </tr>
                <tr>
                    <td>Customer Id: </td> <td><asp:Label ID="Label3" runat="server" Text='<%# Eval("customerId")%>'></asp:Label></td>
                </tr>
                <tr>
                    <td>Issue Date: </td> <td><asp:Label ID="Label4" runat="server" Text='<%# Eval("issueDate")%>'></asp:Label></td>
                </tr>
                <tr>
                    <td>Return Date: </td> <td><asp:Label ID="Label5" runat="server" Text='<%# Eval("returnDate")%>'></asp:Label></td>
                </tr>
                <tr>
                    <td>Rental Fee: </td> <td><asp:Label ID="Label6" runat="server" Text='<%# Eval("rentalFee","{0:C}")%>'></asp:Label></td>
                </tr>
            </ItemTemplate>

            <EditItemTemplate>
                
                <tr>
                    <td>Invoice Number: </td> <td><asp:Label ID="Label1" runat="server" Text='<%# Eval("invoiceNumber")%>'></asp:Label></td>
                <tr>
                    <td>VIN Id: </td> <td><asp:TextBox ID="edit2" runat="server" Text='<%# Bind("vinId")%>'></asp:TextBox></td>
                </tr>
                <tr>
                    <td>Customer Id: </td> <td><asp:TextBox ID="edit3" runat="server" Text='<%# Bind("customerId")%>'></asp:TextBox></td>
                </tr>
                <tr>
                    <td>Issue Date: </td> <td><asp:TextBox ID="edit4" runat="server" Text='<%# Bind("issueDate")%>'></asp:TextBox></td>
                </tr>
                <tr>
                    <td>Return Date: </td> <td><asp:TextBox ID="edit5" runat="server" Text='<%# Bind("returnDate")%>'></asp:TextBox></td>
                </tr>
                <tr>
                    <td>Rental Fee: </td> <td><asp:TextBox ID="edit6" runat="server" Text='<%# Bind("rentalFee")%>'></asp:TextBox></td>
                </tr>
                <tr>
                    <td>
                        <asp:LinkButton ID="updateLink" runat="server" CommandName="Update" Text="Update"/>&nbsp;
                        <asp:LinkButton ID="cancelUpdateLink" runat="server" CommandName="Cancel" Text="Cancel"/>
                    </td>
                </tr>
            </EditItemTemplate>

            <InsertItemTemplate>
                
                <tr>
                    <td>Invoice Number: </td> <td><asp:TextBox ID="insert1" runat="server" Text='<%# Bind("invoiceNumber")%>'></asp:TextBox></td>
                </tr>
                <tr>
                    <td>VIN Id: </td> <td><asp:TextBox ID="insert2" runat="server" Text='<%# Bind("vinId")%>'></asp:TextBox></td>
                </tr>
                <tr>
                    <td>Customer Id: </td> <td><asp:TextBox ID="insert3" runat="server" Text='<%# Bind("customerId")%>'></asp:TextBox></td>
                </tr>
                <tr>
                    <td>Issue Date: </td> <td><asp:TextBox ID="insert4" runat="server" Text='<%# Bind("issueDate")%>'></asp:TextBox></td>
                </tr>
                <tr>
                    <td>Return Date: </td> <td><asp:TextBox ID="insert5" runat="server" Text='<%# Bind("returnDate")%>'></asp:TextBox></td>
                </tr>
                <tr>
                    <td>Rental Fee: </td> <td><asp:TextBox ID="insert6" runat="server" Text='<%# Bind("rentalFee")%>'></asp:TextBox></td>
                </tr>
                <tr>
                    <td>
                        <asp:LinkButton ID="insertLink" runat="server" CommandName="Insert" Text="Insert"/>&nbsp;
                        <asp:LinkButton ID="cancelInsertLink" runat="server" CommandName="Cancel" Text="Cancel"/>
                    </td>
                </tr>
            </InsertItemTemplate>

        </asp:FormView>

    </div>
</asp:Content>

<asp:Content ID="Content3" runat="server" ContentPlaceHolderID="footerPlaceHolder">
</asp:Content>

